import request from '@/untils/request'

//展示所有同部门的联系人    ---> 同部门的权限还没有设定
export const selectAllLinkman = () => {
    return request({
        url: `/exchange/selectAllLinkman`,
        method: 'GET'
    })
}


//查询用户与联系人的聊天内容
export const chattingRecordsBySenderAndRecipient = (sender = null, recipient = null) => {
    return request({
        url: `/exchange/chattingRecordsBySenderAndRecipient`,
        method: 'GET',
        params:{
            sender,
            recipient
        }
    })
}


//查询与每个联系人未读的消息数量      [和别的接口相互关联]
export const senderUnreadQuantity = (sender = null) => {
    return request({
        url: `/exchange/senderUnreadQuantity`,
        method: 'GET',
        params:{
            sender
        }
    })
}


//发送聊天信息       发送者  ---> 联系人
export const senderExchange = (form) => {
    return request({
        url: `/exchange/senderExchange`,
        method: 'POST',
        data: form
    })
}

//将聊天对话的用户  进行修改     ----->  未读--->转变为--->已读
export const updateUnread = (sender = null, recipient = null) => {
    return request({
        url: `/exchange/updateUnread`,
        method: 'PUT',
        params: {
            sender,
            recipient
        }
    })
}


